using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BE;
using BL;
using System.Data.OracleClient;
using System.Data.Common;
using System.Collections.Generic;


public partial class _Login : BasePage
{
    #region Eventos
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Title = "Alamo Drilling - Login"; // Resources.Resource.lblLoginPageName;

        //txtLogin.Focus();

        String strLogin = "DIAMANTINA"; // txtLogin.Text.Trim().ToUpper();
        String strPassword = "123";  //txtPassword.Text.Trim();

        Usuario oUsuario = UsuarioBO.ValidarUsuario(strLogin, Configuracion.CryptString(strPassword));
        if (oUsuario == null)
        {
            lblMessage.Text = Resources.Resource.msg_UsuarioInvalido;
        }
        else
        {
            FormsAuthentication.SetAuthCookie("", false);
            Session[Constans.SessionUsuario.ToString()] = oUsuario;
            Response.Redirect("Default.aspx");
        }

    }    
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        String strLogin = txtLogin.Text.Trim().ToUpper();
        String strPassword = txtPassword.Text.Trim();

        Usuario oUsuario = UsuarioBO.ValidarUsuario(strLogin, Configuracion.CryptString(strPassword));
        if (oUsuario == null)
        {
            lblMessage.Text = Resources.Resource.msg_UsuarioInvalido;
        }
        else
        {
            FormsAuthentication.SetAuthCookie("", false);
            Session[Constans.SessionUsuario.ToString()] = oUsuario;
            Response.Redirect("Default.aspx");
        }
    }
    #endregion
}
